#include "Subject.h"
#include "Observer.h"

#include <list>

Subject::Subject(void)
{
}

Subject::~Subject(void)
{
}

void Subject::attach(Observer* pObserver)
{
	m_observerList.push_back(pObserver);
}

void Subject::detach(Observer* pObserver)
{
	m_observerList.remove(pObserver);
}

void Subject::update()
{
	std::list<Observer*>::iterator it;
	for (it = m_observerList.begin();
		it != m_observerList.end(); ++it)
	{
		(*it)->update(this);
	}
}

